package com.yesep.learn.design.behavioral.mediator;

/**
 * 具体同事
 */
public class ConcreteColleague implements IColleague {

    private String name;


    private IMediator mediator;

    public ConcreteColleague(String name) {
        this.name = name;
    }

    @Override
    public String getName() {
        return name;
    }

    @Override
    public void setName(String name) {
        this.name = name;
    }

    @Override
    public IMediator getMediator() {
        return mediator;
    }

    @Override
    public void setMediator(IMediator mediator) {
        this.mediator = mediator;
    }

    @Override
    public void send(String to, String message) {
        mediator.broadcast(name, to, message);
    }

    @Override
    public void receive(String from, String message) {
        System.out.printf("%s呼叫%s：%s\n", from, name, message);
    }
}
